package com.zzzyh.forumsystemclient.services.impl;

import com.zzzyh.forumsystemclient.dao.BoardMapper;
import com.zzzyh.forumsystemclient.model.Article_Board;
import com.zzzyh.forumsystemclient.model.Board;
import com.zzzyh.forumsystemclient.services.IBoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BoardServiceImpl implements IBoardService {
    @Autowired
    private BoardMapper boardMapper;


    public List<Board> getBoardsByNum(int num){
        return boardMapper.getBoardsByNum(num);
    }

    @Override
    public Board getBoardByBoardname(String boardname) {
        return boardMapper.selectByBoardname(boardname);
    }

    @Override
    public void updateBoard(Board board) {
        boardMapper.updateByPrimaryKeySelective(board);
    }

    @Override
    public void createBoard(Board board) {
        boardMapper.insertSelective(board);
    }

    @Override
    public Board getBoardById(Long boardId) {
        return boardMapper.selectByPrimaryKey(boardId);
    }
}
